Electronic devices utilize a variety of security mechanisms to prevent unauthorized data access. For example, some electronic devices include features that prompt a user to provide a passcode or pin before granting the user access to data stored on the device. Protecting pin confidentiality presents a number of challenges. For instance, users may readily forget pins or passcodes that are too long or complicated. While easier to remember, shorter pins are at risk of being “shoulder-hacked” by bystanders in plain view of the electronic device. For example, a bystander may gain knowledge of a security pin by discretely watching over a user's shoulder while the user enters a pin in a public place. Other image-based security technologies, such as retinal scanning and fingerprint detection, can be complicated to implement.